<%

// The anch macro should not be used anymore!
// Please use markdown links instead!

// See https://github.com/mdn/content/pull/13802 for en-US removal
// This macro can be removed once translated-content removed all {{anch}} calls

// Throw a MacroDeprecatedError flaw
mdn.deprecated()


// Inserts a link to an in-page section, given the section name.
//
// Parameters:
//  $0  Anchor name; you may use spaces here instead of underscores -- these
//      are converted for you.
//  $1  (optional) Text to display instead of the anchor name itself.
//
// Examples:
//  {{anch("Some section's title")}}
//  {{anch("Another section name", "the information elsewhere in this article.")}}

var text = $1 || $0;
var anchor = `#${$0.replace(/ /g, '_').toLowerCase()}`;

%><a href="<%- anchor %>"><%- text %></a>
